package cn.iocoder.yudao.module.system.dal.mysql.alert;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.alert.AlertDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.alert.vo.*;

/**
 * 预警信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface AlertMapper extends BaseMapperX<AlertDO> {

    default PageResult<AlertDO> selectPage(AlertPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AlertDO>()
                .eqIfPresent(AlertDO::getTitle, reqVO.getTitle())
                .eqIfPresent(AlertDO::getContent, reqVO.getContent())
                .eqIfPresent(AlertDO::getType, reqVO.getType())
                .eqIfPresent(AlertDO::getProcessMethod, reqVO.getProcessMethod())
                .eqIfPresent(AlertDO::getStatus, reqVO.getStatus())
                .eqIfPresent(AlertDO::getDepartment, reqVO.getDepartment())
                .eqIfPresent(AlertDO::getExternalData, reqVO.getExternalData())
                .betweenIfPresent(AlertDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AlertDO::getId));
    }

}